package com.lyshop.guiyingshanding.view;

import android.content.Context;
import android.content.Intent;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.lyshop.guiyingshanding.R;
import com.lyshop.guiyingshanding.application.MyApplication;


public class OrderGuideSuccessDialog extends MyDialog implements View.OnClickListener {

    private View rootView;
    private View view_top;
    private TextView tv_integral;
    private TextView tv_cancel;
    private TextView tv_submit;
    private boolean isGuide;

    public OrderGuideSuccessDialog(Context context) {
        this(context, false, Gravity.BOTTOM);
    }

    public OrderGuideSuccessDialog(Context context, boolean isCancelAble, int gravity) {
        super(context, isCancelAble, gravity);
        Window w = this.getWindow();
        if (w != null) {
            w.setWindowAnimations(R.style.dialogTranslateAnim);
        }
        rootView = LayoutInflater.from(context).inflate(R.layout.dialog_order_guide_success, null);
        setContentView(rootView);

        view_top = rootView.findViewById(R.id.view_top);
        tv_integral = rootView.findViewById(R.id.tv_integral);
        tv_cancel = rootView.findViewById(R.id.tv_cancel);
        tv_submit = rootView.findViewById(R.id.tv_submit);

        tv_cancel.setOnClickListener(this);
        tv_submit.setOnClickListener(this);
        view_top.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.view_top:
                if (isCancelAble) {
                    dismiss();
                }
                break;
            case R.id.tv_cancel:
                dismiss();
                mContext.sendBroadcast(new Intent(MyApplication.GO_TO_ORDER_ACTION));
                break;
            case R.id.tv_submit:
                mContext.sendBroadcast(new Intent(MyApplication.GO_TO_ORDER_ACTION));
                dismiss();
                break;
        }
    }


}

